/**
 * create by young (young2f@outlook.com) on 2020/12/3
 */
'use strict';
const model = require('../base/modelBase');
const _ = require('lodash');
module.exports = app => {
    const mongoose = app.mongoose;
    const schema = mongoose.Schema;
    //schema.plugin(require('mongoose-timestamp'));
   // schema.set('timestamps', true);
    const connect = app.mongooseDB.get('aiotBusiness');
    const json = {
        points: { type: Object },
        deviceId: { type: String, desc: '设备编码' },
        deviceName: { type: String, desc: '设备名称' },
        status: { type: Number, desc: '状态' },
        time: { type: Number, desc: '时间' },
        deviceType: { type: String, desc: '状态' },
        createdAt: { type: Date },

    };
    const _model = _.cloneDeep(model);
    _.assign(_model, json);
    const _schema = new schema(
        _model,
        //{ timestamps: { createdAt: 'createdTs', updatedAt: 'updatedTs' } }
    );
    return connect.model('DeviceProp', _schema);
};
